// app.js
import config from './config';
import createBus from './utils/eventBus';

App({
  onLaunch() {
    wx.cloud.init({
      env: 'cloud1-5glactmvb0dcbc62',
      traceUser: true
    })
    const updateManager = wx.getUpdateManager();

    updateManager.onCheckForUpdate((res) => {
      // console.log(res.hasUpdate)
      
    });
    updateManager.onUpdateReady(() => {
      wx.showModal({
        title: '更新提示',
        content: '新版本已经准备好，是否重启应用？',
        success(res) {
          if (res.confirm) {
            updateManager.applyUpdate();
          }
        },
      });
    });
  },
  globalData: {
    userInfo: null,
    needRefresh: true,
    queryInfo: {q:'', nps: {
      status: [false, false],
      min: 0,
      max: 20.0
    }},
    songs: {}
  },

  /** 全局事件总线 */
  eventBus: createBus(), 
});
